﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using hospital_registration_system.Entity;
using hospital_registration_system.DAL;

namespace hospital_registration_system.manager
{
    public partial class managerLogin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            ManagerDao dao = new ManagerDao();
            if (username.Text == null || password.Text == null) return;
            Manager manager = null;
            manager = dao.Login(username.Text, password.Text);
            if (manager == null)
                return;
            else
            {
                Session.Add("manager", manager);
                Response.Redirect("/manager/management.aspx");
            }

        }

        public bool IsEmail(string str)
        {
            foreach (char ch in str)
            {
                if (ch < '0' || ch > '9')
                    return true;
            }
            return false;
        }
    }
}